﻿using System;
using System.Runtime.InteropServices;

namespace Ast.Core.Services.ObjectDefinitions
{
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 1)]
    public struct ObjectDirectory
    {
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 37)]
        public IntPtr[] HashBuckets;

        public uint Lock;

        public IntPtr DeviceMap;

        public IntPtr ShadowDirectory;

        public uint SessionId;

        public IntPtr NamespaceEntry;

        public uint Flags;
    }

    /*
lkd> dt _object_directory -v
nt!_OBJECT_DIRECTORY
struct _OBJECT_DIRECTORY, 7 elements, 0xa8 bytes
    +0x000 HashBuckets      : [37] Ptr32 to struct _OBJECT_DIRECTORY_ENTRY, 3 elements, 0xc bytes
    +0x094 Lock             : struct _EX_PUSH_LOCK, 7 elements, 0x4 bytes
    +0x098 DeviceMap        : Ptr32 to struct _DEVICE_MAP, 6 elements, 0x34 bytes
    +0x098 ShadowDirectory  : Ptr32 to struct _OBJECT_DIRECTORY, 7 elements, 0xa8 bytes
    +0x09c SessionId        : Uint4B
    +0x0a0 NamespaceEntry   : Ptr32 to Void
    +0x0a4 Flags            : Uint4B
    */
}